package org.deschutter.exceptions;

import java.math.BigDecimal;

/**
 * User: Berten De Schutter
 * Date: 08-Jul-2009
 * Time: 14:55:34
 */
public class AddActionException extends Exception {
    String mistake;
    private String planetOrigin, rulerOrigin, planetTarget, rulerTarget, scanID;
    private BigDecimal landingTick;

    public AddActionException() {
        super();             // call superclass constructor
        mistake = "unknown";
    }


    public AddActionException(String err) {
        super(err);     // call super class constructor
        mistake = err;  // save message
    }


    public AddActionException(String err, String scanID, String planetOrigin, String rulerOrigin, String planetTarget, String rulerTarget, BigDecimal landingTick) {
        super(err);     // call super class constructor
        mistake = err;  // save message
        this.scanID = scanID;
        this.planetOrigin = planetOrigin;
        this.rulerOrigin = rulerOrigin;
        this.planetTarget = planetTarget;
        this.rulerTarget = rulerTarget;
        this.landingTick = landingTick;
    }


    public String getError() {

        if (planetOrigin == null) {
            return mistake;
        } else {
            return "[ADD ACTION EXCEPTION] Scan Id:" + scanID + "Planet-Ruler origin: " + planetOrigin + "-" + rulerOrigin + ". Planet-Ruler target: " + planetTarget + "-" + planetOrigin + " Landing Tick:" + landingTick;
        }
    }

    public String getMistake() {
        return mistake;
    }

    public void setMistake(String mistake) {
        this.mistake = mistake;
    }

    public String getPlanetOrigin() {
        return planetOrigin;
    }

    public void setPlanetOrigin(String planetOrigin) {
        this.planetOrigin = planetOrigin;
    }

    public String getRulerOrigin() {
        return rulerOrigin;
    }

    public void setRulerOrigin(String rulerOrigin) {
        this.rulerOrigin = rulerOrigin;
    }

    public String getPlanetTarget() {
        return planetTarget;
    }

    public void setPlanetTarget(String planetTarget) {
        this.planetTarget = planetTarget;
    }

    public String getRulerTarget() {
        return rulerTarget;
    }

    public void setRulerTarget(String rulerTarget) {
        this.rulerTarget = rulerTarget;
    }

    public String getScanID() {
        return scanID;
    }

    public void setScanID(String scanID) {
        this.scanID = scanID;
    }

    public BigDecimal getLandingTick() {
        return landingTick;
    }

    public void setLandingTick(BigDecimal landingTick) {
        this.landingTick = landingTick;
    }
}
